package com.hbyj.object;

import java.util.ArrayList;
import java.util.List;

import com.hbyj.hbm.vo.Departments;

public class FlexGridData {
	private Integer total;
	private Integer page;
	private List<FlexGridRowForDepartment> rows;
	
	public FlexGridData(Integer total,Integer page,List departmentsList){
		setTotal(total);
		setPage(page);
		List<FlexGridRowForDepartment> rows =this.PackDepartments(departmentsList);
	    setRows(	rows);
	}
	
	private List<FlexGridRowForDepartment> PackDepartments(List departmentsList)
	{
		if(departmentsList==null)
			return null;
		List<FlexGridRowForDepartment> rlts = new ArrayList<FlexGridRowForDepartment>();
		for (Object element : departmentsList) {
			Departments depart = (Departments)element;
			FlexGridRowForDepartment row = new FlexGridRowForDepartment(depart);
			rlts.add(row);
		}
		return rlts;
	}
	
	public void setTotal(Integer total) {
		this.total = total;
	}
	public Integer getTotal() {
		return total;
	}
	public void setPage(Integer page) {
		this.page = page;
	}
	public Integer getPage() {
		return page;
	}
	public void setRows(List<FlexGridRowForDepartment> rows) {
		this.rows = rows;
	}
	public List<FlexGridRowForDepartment> getRows() {
		return rows;
	}
}
